/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#pragma once

#ifdef WIN32
#include <win32/win32.h>
#endif

#ifdef MARMALADE
#include <IwGL.h>
#include <Gluck.h>
#endif

namespace liba
{
#if defined(IPHONE_VERSION)
class WindowImpl
{
	void * wnd;
public:
	WindowImpl( void * wnd )
	:	wnd( wnd )
	{}
	void * get_layer()const
	{
		return wnd;
	}
};	
#endif

#if defined(SAMSUNG_VERSION) || defined(ANDROID_NDK)
class WindowImpl
{
public:
	int width;
	int height;

	WindowImpl(int width, int height)
	:	width(width),
		height(height)
	{}
};	
#endif

#if defined(MAC_VERSION) && !defined(IPHONE_VERSION) && !defined(ANDROID_NDK)
class WindowImpl
{
	WindowRef wnd;
public:
	WindowImpl( WindowRef wnd )
	:	wnd( wnd )
	{}
	WindowRef get_wnd()const
	{
		return wnd;
	}
	WindowRef & get_wnd_bug()
	{
		return wnd;
	}
};
#endif

#ifdef WIN32
class WindowImpl
{
	HINSTANCE instance;
	HWND wnd;
public:
	WindowImpl( HINSTANCE instance, HWND wnd )
	:	instance( instance ),
		wnd( wnd )
	{}
	HINSTANCE get_instance()const
	{
		return instance;
	}
	HWND get_wnd()const
	{
		return wnd;
	}
};
#endif

#ifdef MARMALADE
class WindowImpl
{
public:
	WindowImpl()
	{
		if(!IwGLInit())
			THROW(Gluck(__FUNCTION__, "Unable to initialize Marmalade's OpenGL system."));
	}
	int GetWidth()
	{
		return IwGLGetInt(IW_GL_WIDTH);
	}
	int GetHeight()
	{
		return IwGLGetInt(IW_GL_HEIGHT);
	}
};
#endif

} // namespace liba
using namespace liba;
